package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
)

func main() {
	username := "admin"
	password := "admin"
	client := &http.Client{}
	req, err := http.NewRequest("GET", "http://10.0.12.67:8006/stats;csv", nil)
	req.SetBasicAuth(username, password)
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("Error: ", err)
		return
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("Error: ", err)
		return
	}

	lines := strings.Split(string(body), "\n")
	for _, line := range lines {
		fields := strings.Split(line, ",")
		if len(fields) > 7 && fields[0] != "#" {
			fmt.Printf("%s:%s %s\n", fields[1], fields[2], fields[17])
		}
	}
}
